Computational Effects across Generated Binders Maintaining future-stage lexical scope

نویسندگان

  • Yukiyoshi Kameyama
  • Oleg Kiselyov
  • Chung-chieh Shan
چکیده

Code generation is the leading approach to making high-performance software reusable. Effects are indispensable in code generators, whether to report failures or to insert let-statements and ifguards. Extensive painful experience shows that unrestricted effects interact with generated binders in undesirable ways to produce unexpectedly unbound variables, or worse, unexpectedly bound ones. These subtleties prevent experts in the application domain, not in programming languages, from using and extending the generator. A pressing problem is thus to express the desired effects while regulating them so that the generated code is correct, or at least correctly scoped, by construction. In an imminently practical code-generation framework, we show how to express arbitrary effects, including mutable references and delimited control, that move open code across generated binders. The static types of our generator expressions not only ensure that a well-typed generator produces well-typed and well-scoped code, but also express the lexical scopes of generated binders and prevent mixing up variables with different scopes. This precise notion of lexical scope subsumes the complaints about intuitively wrong example generators in the literature. For the first time, we demonstrate statically safe let-insertion across an arbitrary number of binders. Our framework is implemented as a Haskell library that embeds an extensible typed higher-order domain-specific language. It may be regarded as ‘staged Haskell.’ The library is convenient to use thanks to the maturity of Haskell, higher-order abstract syntax, and polymorphism over generated type environments.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Cognitive Task Complexity and Iranian EFL Learners’ Written Linguistic Performance across Writing Proficiency Levels

Recently tasks, as the basic units of syllabi, and the cognitive complexity, as the criterion for sequencing them, have caught many second language researchers’ attention. This study sought to explore the effect of utilizing the cognitively simple and complex tasks on high- and low-proficient EFL Iranian writers’ linguistic performance, i.e., fluency, accuracy, lexical complexity, and structura...

متن کامل

Measuring Individual Differences in Word Recognition: The Role of Individual Lexical Behaviors

This study adopts a corpus-based computational linguistic approach to measure individual differences (IDs) in visual word recognition. Word recognition has been a cardinal issue in the field of psycholinguistics. Previous studies examined the IDs by resorting to test-based or questionnaire-based measures. Those measures, however, confined the research within the scope where they can evaluate. T...

متن کامل

Semantic Ambiguity Effects in Lexical Processing: A Neural-Network Account Based on Semantic Settling Dynamics

The meanings of most words depend on the context in which they occur (e.g., vs. BANK). Developing a theory of how comprehension of semantically ambiguous words are understood is a critical aspect of any theory of word or discourse comprehension. However, success to date has been limited by discrepancies in the effects of relatedness of meaning observed within and between tasks. ...

متن کامل

Neural correlates reveal sub-lexical orthography and phonology during reading aloud: a review

The sub-lexical conversion of graphemes-to-phonemes (GPC) during reading has been investigated extensively with behavioral measures, as well as event-related potentials (ERPs). Most research utilizes silent reading (e.g., lexical decision task) for which phonological activation is not a necessity. However, recent research employed reading aloud to capture sub-lexical GPC. The masked priming par...

متن کامل

Two-stage column generation

We introduce a new concept in column generation for handling complex large scale optimization problems, called two-stage column generation, where columns for the compact and extensive formulation are simultaneously generated. The new framework is specifically conceived for tackling complex problems that cannot be efficiently solved by standard column generation and exploits the relationship bet...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2011